package com.example.fragment;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * Created by 半生瓜 on 2017/4/1.
 */
class ViewHolder {

 public TextView show_time;
 public TextView show_title;
 public ImageView image;
    public View line_normal;
        }
public class MyAdapter extends BaseAdapter {
    private LayoutInflater mInflater = null;

             public MyAdapter(Context context) {
                 super();
                 mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             }


    @Override
    public int getCount() {
        //TODO 控制listview的长度
        return 5;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if(view==null) {
            holder=new ViewHolder();
            view=mInflater.inflate(R.layout.item_view,null);
            holder.line_normal=(View)view.findViewById(R.id.line_normal);
            holder.show_time=(TextView)view.findViewById(R.id.show_time);
//            holder.show_title=(TextView)view.findViewById(R.id.show_title);
            holder.image=(ImageView)view.findViewById(R.id.image_1);
            view.setTag(holder);
        }else {
            holder=(ViewHolder)view.getTag();
        }

//            holder.show_title.setText("xxxx"+i);
//            holder.show_time.setText("sssss");


          return view;
    }
}
